<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>登录</title>
	<meta http-equiv="pragma" content="no-cache">
	
	<link rel="stylesheet" type="text/css" href="<%=basePath %>css/form.css" />
  </head>
  
  <body>

     <form:form commandName="company" action="registerCompany.do" onsubmit="return validate(this)">
     <table>
        <tr>
         <td>
           <label for="name">企业名称：</label>
           <form:input path="name" cssClass="require"/>
           <form:errors path="name" />
         </td>
       </tr>
        <tr>
          <td>
            <label for="id">标签：</label>
            <form:input path="keyWord" cssClass="require"/>
            <form:errors path="keyWord" />
           </td>
       </tr>
       <tr>
          <td><small>（标签有助于客户搜索出该企业，多个标签之间请用空格隔开）</small></td>
       </tr>
       <tr>
         <td>
           <label for="account">账号：</label>
           <form:input path="account" cssClass="require"/>
           <form:errors path="account" />
         </td>
       </tr>
       <tr>
         <td>
           <label for="password">密码：</label>
           <form:password path="password" cssClass="require"/>
           <form:errors path="password" />
         </td>
       </tr>
        <tr>
         <td>
           <label for="password_2">重复密码：</label>
           <input type="password" name="password_2" id="password_2" class="require">
         </td>
       </tr>
     
       <tr>
          <td colspan="2">
               <input type="submit" value="注 册" />
          </td>
       </tr>
       </table>
   </form:form>


<script type="text/javascript" src="<%=basePath %>js/formValidate.js"></script>
<script type="text/javascript">

  function validate(form){

      if(!emptyValidate(form)){
      
          return false;
      }


      var p1=document.getElementById('password').value;
      var p2=document.getElementById('password_2').value;
      
      if(p1!=p2){
          
           var mes=document.createElement("span");
           
           mes.innerHTML="password not match";
         
           document.getElementById('password_2').parentElement.appendChild(mes);
           
           return false;
      
      }else{
           
           return true;     
      }
  };

</script>

  </body>
</html>
